<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<table class="table table-bordered" style="border-bottom: none">
	<tr>
		<td>
			<ul id="${param.rel}_tree" class="ztree"></ul>
		</td>
	</tr>
</table>
<script type="text/javascript">
	$(document).ready(function() {

		var setting = {
			check : {
				enable : true,
				chkStyle: "radio"
			},
			data : {
				simpleData : {
					enable : true
				}
			},
			callback: {
				onCheck: onCheck
			}
		};
		
		
		function onCheck(e, treeId, treeNode){
		    var treeObj = $.fn.zTree.getZTreeObj("${param.rel}_tree");
	        var nodes = treeObj.getCheckedNodes(true);
	        $.each(nodes,function(){
	        	if(treeNode.id!=this.id){
	        	 treeObj.checkNode(treeObj.getNodeByParam("id", this.id, null), false, false);
	        	}
	        });
			$.bringBack({lookup:'${param.lookup}',id:treeNode.id,name:treeNode.name});
	        
		}

		var zNodes = ${json};
		$.fn.zTree.init($("#${param.rel}_tree"), setting, zNodes);

	});
</script>